function getFileExtension(filename)
{
  var ext = /(^.+)\.([^.]+)$/.exec(filename);
  return ext;
}


	var prepare_slider = function(){
		
		var x_pos = 0;
		var li_items_n = 0;	
		var right_clicks = 0;
		var viewWindow = 7;
		var left_clicks = 0;
		
		var li_col = $("#slider_list li");
	
		li_col.each(function(index){
			//size = li.getSize();
			x_pos += $(this).width();

			li_items_n++;
			
			$(this, "img").css('cursor','pointer');
			
		
		
		})
		
		
		right_clicks = li_items_n - viewWindow;
		total_clicks = li_items_n - viewWindow;
		
		$('#slider_list').css('position','relative');
		$('#slider_list').css('left','0px');
		$('#slider_list').css('width', x_pos+'px');
		
		
		
		

	
		var is_playing = false;

		var completed = function() { is_playing = false; }

		$('#left_but').click( function(){
												 
			
			cur_offset = $('#slider_list').position().left;
			

			
			
if (!is_playing)									 {
			
			if (left_clicks > 0) {is_playing = true; $('#slider_list').animate({'left': cur_offset + 112 + 'px'}, 700, "linear", completed); right_clicks++; left_clicks--;} else {is_playing = true; $('#slider_list').animate({'left':    -116*total_clicks	+ 'px'}, 700, "linear", completed); right_clicks = 0; left_clicks = total_clicks;}
}
		});

		$('#right_but').click( function(){

			if (!is_playing)									 {
			
			cur_offset = $('#slider_list').position().left;
			
			 if (right_clicks > 0) {is_playing = true; $('#slider_list').animate({'left': cur_offset - 120 + 'px'},700, "linear", completed ); right_clicks--; left_clicks++; } else { is_playing = true; $('#slider_list').animate({'left':    0	+ 'px'},700, "linear", completed ); left_clicks = 0; right_clicks = total_clicks;}
			 
												  }
			 });	
		
	}
